/**
 * 
 */
package jmine.tec.report;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Executable data table. Is not an instanceof {@link DataTable}, even tough they share similiarities.
 * 
 * @author takeshi
 * @version 29/08/2007
 */
public interface ExecutableDataTable extends Serializable {

    /**
     * @param row the {@link ExecutableDataRow} to add
     */
    void addRow(ExecutableDataRow row);

    /**
     * Clears all cells from the added rows and executes all the columns in this {@link ExecutableDataTable}, returning a view witch may be
     * safely serialized.
     * 
     * @param parameters the map of parameters to use
     * @return {@link DataTable}
     */
    DataTable executeAndView(Map<String, Object> parameters);

    /**
     * Adds an {@link ExecutableDataColumn} to this {@link ExecutableDataTable}. The column will be executed when the
     * {@link #executeAndView(Map)} method is called.
     * 
     * @param column {@link ExecutableDataColumn}
     */
    void addColumn(ExecutableDataColumn column);

    /**
     * Removes all {@link ExecutableDataRow} for executing again
     */
    void removeAllRows();

    /**
     * Adds a bunch of dataRows
     * 
     * @param rows the {@link Collection} of {@link ExecutableDataRow}
     */
    void addRows(Collection<? extends ExecutableDataRow> rows);

    /**
     * Returns a {@link List} view containing all {@link ExecutableDataRow} of this {@link ExecutableDataTable}. If
     * {@link ExecutableDataTable} has been executed, the rows will contains the data from the execution. Modifications on the list will not
     * reflect back on this {@link ExecutableDataTable}.
     * 
     * @return {@link List} de {@link ExecutableDataRow}
     */
    List<ExecutableDataRow> getExecutableRows();

}
